package com.zxt.dlykserver.service.impl;

import com.zxt.dlykserver.entity.TUser;
import com.zxt.dlykserver.mapper.TUserMapper;
import com.zxt.dlykserver.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private TUserMapper userMapper;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        TUser user = userMapper.selectLoginAct(username);
        if (user==null){
            throw new UsernameNotFoundException("用户不存在");
        }
        return user;
    }
}
